const Service = require('egg').Service;

class TaskPriorityService extends Service {
  async findAll(payload) {
    const { ctx } = this;
    const { limit, offset, prop_order, order } = payload;
    const where = payload.where;
    const Order = [];
    prop_order && order ? Order.push([prop_order, order]) : null;
    return await ctx.model.TaskPrioritys.findAndCountAll({
      limit,
      offset,
      where,
      order: Order,
    });
  }
}

module.exports = TaskPriorityService;